package cn.cmcc.intertelecom.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.cmcc.intertelecom.bean.User;
import cn.cmcc.intertelecom.bean.UserExample;
import cn.cmcc.intertelecom.bean.UserExample.Criteria;
import cn.cmcc.intertelecom.dao.UserMapper;

@Service
public class LoginService {
	@Autowired
	private UserMapper userMapper;

	public User checkUser(User user) {
		
		UserExample example=new UserExample();
		Criteria criteria = example.createCriteria();
		criteria.andPasswordEqualTo(user.getPassword());
		criteria.andUsernameEqualTo(user.getUsername());
		List<User> list = userMapper.selectByExample(example);
		//long conut = userMapper.countByExample(example);
		if(list.size() == 1){
			return list.get(0);
		}else{
			return null;
		}
		
	}
	
	
	
	
	
}
